from appium import webdriver
from time import sleep
from page.base_page import BasePage
from selenium.webdriver.common.by import By


# desired_capabilities = {
#     'platformName': 'Android',  # 模拟器或真机系统：Android、IOS
#     'deviceName': '127.0.0.1:62001',  # 设备名称：adb devices的值,
#     'platformVersion': '7.1.2',  # 模拟器的系统版本号
#     'appPackage': 'com.gfeng.daydaycook',  # 测试App的系统版本号
#     'appActivity': 'com.gfeng.daydaycook.activity.WelcomeActivity',  # aapt dump badging APK本机路径
#     'noReset': True,  # 启动不被重置
#     'newCommandTimeout': 600,  # 新命令的等待时间
#     'unicodeKeyboard': True,  # 输入法支持中文
#     'resetKeyboard': True  # 输入法重置
# }
# driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_capabilities)  # 实例化驱动driver
# sleep(5)
# # 点击我的
# driver.tap([(973,1866),(973,1866)],500)
# sleep(10)
# #点击菜单栏
# driver.tap([(44,95)],500)
# sleep(5)
# #点击我的订单
# driver.tap([(145,535)],500)
# sleep(5)
# #点击退出
# driver.tap([(45,101)],500)
# sleep(5)
# #点击菜单栏
# driver.tap([(44,95)],500)
# sleep(5)
# #点击优惠卷
# driver.tap([(125,442)],500)
# sleep(5)
class CheckGoods(BasePage):
    def driver_attri(self,driver):
        self.driver=driver
        sleep(3)
    def orderme(self):
        """点击我的"""
        self.driver.tap([(973,1866),(973,1866)],500)
        sleep(3)
    def menubar(self):
        """点击菜单栏"""
        self.driver.tap([(44, 95)], 500)
        sleep(3)
    def myorder(self):
        """点击我的菜单"""
        self.driver.tap([(145, 535)], 500)
        sleep(3)
    def quit(self):
        self.driver.tap([(45, 101)], 500)
        sleep(3)
    def menubarone(self):
        """点击菜单栏"""
        self.driver.tap([(44, 95)], 500)
        sleep(2)
    def coupons(self):
        """点击优惠卷"""
        self.driver.tap([(125, 442)], 500)
        sleep(3)

    def checkgoods(self):
        self.orderme()
        self.menubar()
        self.myorder()
        self.quit()
        self.menubarone()
        self.coupons()






